# ifndef __GarminProtocol_H_
# define __GarminProtocol_H_

# include "GpsProtocol.h"

class CGarminProtocol : public CGpsProtocol {
  public:
	// Override.
	virtual void GetName (string_t & _strName) const;
	virtual void Start ();
	virtual void Stop ();
	virtual CGpsProtocol::Status_t OnDataReceived (const BYTE * _pData, size_t _cSize);

  private:
	void RequestPVT ();

	void OnACK (BYTE _btPacketIDAcknowleged);
	void OnNAK (BYTE _btPacketIDRejected);
	bool OnPacketEnd ();
	void OnByteReceived (BYTE _bt);
	BYTE m_btPrev;

	BYTE m_packet [256];
	size_t m_cPacketLen;
	BYTE m_btPacketID;

	DWORD m_dwPVTRequestTime;
	bool m_bPVTRequested;
	bool m_bPVTAcknowledged;

	DWORD m_dwLastDataTime;
};

# endif // __GarminProtocol_H_